/* 
 * PD 2011-11-05
 * Skrypt deva w jq pokazywanie ukrywanie
 */

   
$(document).ready(
        function()
        {    
            console.log("jq działa");
            $('#dev_hide,#dev,#devPost_hide,#devPost,#devUser_hide,#devUser,#devSql_hide,#devSql,#devInne_hide,#devInne,#pozycje_dev').css("display","none ");
           
           
           $("#dev_show").click(function () 
           {
                console.log("show");
                $('#dev_show').css("display","none ");
                $('#dev_hide').css("display","block");
                $('#dev').css("display","block");
                $('#dev').css("background-color","white");
                $('#dev').css("border","3px solid red ");
                //$('#pozycje_dev').css("display","none ");
                
           }
           );
           
           $("#dev_klucz").live("click", function(){ 
              // po kliknieciu klucza pokazuje tylko pozycje pod kluczem a wiec w divie dev_klucz jest nastepny div .pozycje_dev
        	  $(this).children(".pozycje_dev").css("display","block");
        	

           });  
           
           //pokazanie wszystkich pozycji w devie - nie wiem jak w livie zrobic toogle wiec zastosowalem myka :)
           // w js zmienne sa globalne :)
           var flaga_dev_all=false;
           $("#dev_show_all").live("click", function()
           { 
         	  console.log(flaga_dev_all+'kliknieto all');
              if( flaga_dev_all == false )
         	  {
            	 console.log('kliknieto all111');
        		 $("#dev_all").css("display","block");
                 flaga_dev_all=true;
         	  }
              else
              {
            	  console.log('kliknieto all222');
            	  $("#dev_all").css("display","none");
            	  flaga_dev_all=false;
              }	  
            });
           
           
           $("#dev_hide").click(function () 
           {
                console.log("hide");
                $('#dev_show').css("display","block");
                $('#dev_hide').css("display","none ");
                $('#dev').css("display","none");
                //$('#dev').css("border","3px solid red ");
           }
           );
               
            $("#devPost_show").click(function () 
           {
                console.log("show");
                $('#devPost_show').css("display","none ");
                $('#devPost_hide').css("display","block");
                $('#devPost').css("display","block");
                $('#devPost').css("background-color","white");
                $('#devPost').css("border","3px solid green ");
           }
           );

           $("#devPost_hide").click(function () 
           {
                console.log("hide");
                $('#devPost_show').css("display","block");
                $('#devPost_hide').css("display","none ");
                $('#devPost').css("display","none");
                //$('#dev').css("border","3px solid red ");
           }
           );  
           
 //USER              
               $("#devUser_show").click(function () 
           {
                console.log("show");
                $('#devUser_show').css("display","none ");
                $('#devUser_hide').css("display","block");
                $('#devUser').css("display","block");
                $('#devUser').css("background-color","white");
                $('#devUser').css("border","3px solid yellow ");
           }
           );

           $("#devUser_hide").click(function () 
           {
                $('#devUser_show').css("display","block");
                $('#devUser_hide').css("display","none ");
                $('#devUser').css("display","none");
                //$('#dev').css("border","3px solid red ");
           }
           );  

  //SQL              
           $("#devSql_show").click(function () 
       {
            console.log("show_sql");
            $('#devSql_show').css("display","none ");
            $('#devSql_hide').css("display","block");
            $('#devSql_hide').css("color","black");
            $('#devSql').css("display","block");
            $('#devSql').css("background-color","white");
            $('#devSql').css("border","3px solid pink ");
       }
       );

       $("#devSql_hide").click(function () 
       {
            $('#devSql_show').css("display","block");
            $('#devSql_hide').css("display","none ");
            $('#devSql').css("display","none");
            //$('#dev').css("border","3px solid red ");
       }
       ); 
       
       $("#dev_klucz_sql").live("click", function(){ 
           // po kliknieciu klucza pokazuje tylko pozycje pod kluczem a wiec w divie dev_klucz jest nastepny div .pozycje_dev
     	  $(this).children(".pozycje_dev_sql").css("display","block");
     	

        });  
        
        //pokazanie wszystkich pozycji w devie - nie wiem jak w livie zrobic toogle wiec zastosowalem myka :)
        // w js zmienne sa globalne :)
        var flaga_dev_all_sql=false;
        $("#dev_show_all_sql").live("click", function()
        { 
      	  console.log(flaga_dev_all_sql+'kliknieto all');
           if( flaga_dev_all_sql == false )
      	  {
         	 console.log('kliknieto all111');
     		 $("#dev_all_sql").css("display","block");
              flaga_dev_all_sql=true;
      	  }
           else
           {
         	  console.log('kliknieto all222');
         	  $("#dev_all_sql").css("display","none");
         	  flaga_dev_all_sql=false;
           }	  
         });
        
       
//Inne              
       $("#devInne_show").click(function () 
   {
        console.log("show_Inne");
        $('#devInne_show').css("display","none ");
        $('#devInne_hide').css("display","block");
        $('#devInne_hide').css("color","black");
        $('#devInne').css("display","block");
        $('#devInne').css("background-color","white");
        $('#devInne').css("border","3px solid orange ");
   }
   );

   $("#devInne_hide").click(function () 
   {
        $('#devInne_show').css("display","block");
        $('#devInne_hide').css("display","none ");
        $('#devInne').css("display","none");
        //$('#dev').css("border","3px solid red ");
   }
   ); 
             
               
         });  
